package com.ts.api.common.transaction;

import java.util.function.Supplier;

/**
 * 事务支持(用在@Transactional注解不好用的场景)
 * 
 * @author caoxin
 */
public interface TransactionSupport {

    <T> T requiresNew(Supplier<T> supplier);

    default void requiresNew(Runnable runnable) {
        this.requiresNew(() -> {
            runnable.run();
            return null;
        });
    }

}
